﻿<!-- Logo + Search + Navigation -->
<div id="top">
    <div id="bannerarea" style="padding-bottom: 0px; margin-bottom: 0px">
        @*    <table width="100%" style="padding-bottom: 0px">
        <tr>
            <td>
                <h1 id="logo">
        <a href="#">MONDAYS</a></h1>
    <div id="loginField">
        @Html.Partial("_HeaderLogin")
    </div>
            </td>
            <td style="vertical-align: bottom">
                <div class="roundedField" style="float: right; padding: 10px; background-color: gainsboro">
        <input type="text" id="txtSearchContentString" class="roundedField" value="" title="" style="background: white; border: solid 1px #104E8B;-moz-border-radius-topright: 0px; -webkit-border-top-right-radius: 0px; -moz-border-radius-bottomright: 0px; -webkit-border-bottom-right-radius: 0px"/><input class="colorButton" type="submit" id = "btnSearchContent" style="height: 26px; width: 85px; -moz-border-radius-topleft: 0px; -webkit-border-top-left-radius: 0px; -moz-border-radius-bottomleft: 0px; -webkit-border-bottom-left-radius: 0px" value="Tìm Kiếm"/>
    </div>
            </td>
        </tr>
    </table>*@
        <div id="logo">
            <div class="roundedField" style="float:right; background-color: gainsboro; margin-top: 50px">
                <input type="text" id="txtSearchContentString" class="roundedField" value="" title=""
                    style="background: white; border: solid 1px #104E8B; -moz-border-radius-topright: 0px;
                    -webkit-border-top-right-radius: 0px; -moz-border-radius-bottomright: 0px; -webkit-border-bottom-right-radius: 0px" /><input
                        class="colorSearchButton" type="submit" id="btnSearchContent" style="height: 26px;
                        width: 85px;" value="Tìm Kiếm" />
            </div>
            <a href="/home/index"></a>
            
        </div>
        <div id="loginField">
            @Html.Partial("_HeaderLogin")
        </div>
        @*        <div class="cl">
            &nbsp;</div>
        <div class="cl">
            &nbsp;</div>
    </div>*@
        <nav>
            <ul class="topMenu">
                <li><a href="@Url.Action("Index", "Home")">TRANG CHỦ</a></li>
                <li class="submenu"><a href="@Url.Action("Index", "Guide")">HƯỚNG DẪN</a>
                    <ul class="deviceListGuide">
                    
                    </ul>
                </li>
                <li><a id="questionLink" href="@Url.Action("Index", "Question")">HỎI ĐÁP</a>
                    <ul  class="deviceListQuestion">
                    </ul>
                </li>
                <li><a href="@Url.Action("GetAllUser", "Account")">THÀNH VIÊN</a>                   
                </li>
                @*            <div id="search" style="padding-top: 18px;">
                <span class="field-holder">
                    <input type="text" id="txtSearchContentString" class="field" value="" title="" />
                </span>
                <input type="image" src="/Content/Images/search.ico" class="button" id="btnSearchContent"
                    value="Search"/></div>*@
                @if (User.Identity.IsAuthenticated)
                {
                    <li><a href="@Url.Action("Profile", "Account")">TRANG CỦA BẠN</a>
                        <ul  class="UserMenu">
                            @*<li><a id="" href="@Url.Action("Profile", "Account")">Trang Cá Nhân</a></li>*@
                            @*<li><a id="" href="@Url.Action("Notification", "Account")">Thông Báo Mới (<span id="notificationCount" style="display: inline !important"></span>)</a></li>*@
                        </ul>
                    
                    </li>
                    <button type="submit" id="redNotification" class="roundedField" style="display: none;" onclick="window.location = '/Account/Notification';" title="Xem Thông Báo Mới"></button>
                }
                @*            <table style="float: right; padding-top: 5px;">
                <tr>
                    <td style=" padding-right: 0px">
                        <input type="text" id="txtSearchContentString" class="roundedField" value="" title="" style="background: white"/>
                    </td>
                    <td style="padding-left: 0px">
                        <input type="image" src="/Content/Images/search.ico" class="button" id="btnSearchContent"
                    value="Search" width="25px" height="25px"  style="padding-top: 8px"/>
                    </td>
                </tr>
            </table>*@
            </ul>
        </nav>
        @*@Html.Partial("_HeaderLine")*@
    </div>
    <!-- END Logo + Search + Navigation -->
    <!-- Header -->
    <!-- END Header -->
</div>
<script type="text/javascript">
    $.getJSON('/Home/GetAllDeviceList', {}, function (devices) {
        $.each(devices, function (index, device) {
            var liTextGuide = "<li><a href=\"/Guide/Index?deviceId=" + device.Id + "\">" + device.Name + "</a><ul class=deviceGuide" + device.Id + "></ul></li>";
            var liTextQuestion = "<li><a href=\"/Question/Index?deviceId=" + device.Id + "\">" + device.Name + "</a><ul class=deviceQuestion" + device.Id + "></ul></li>";
            $('.deviceListGuide').append(liTextGuide);
            $('.deviceListQuestion').append(liTextQuestion);
            $.getJSON('/Home/GetManufacturerList', { deviceId: device.Id }, function (manufacturers) {
                $.each(manufacturers, function (index, manufacturer) {
                    var liText1 = "<li><a href=\"/Guide/Index?deviceId=" + device.Id + "&manufacturerId=" + manufacturer.Id + "\">" + manufacturer.Name + "</a><ul class=manufacturer" + manufacturer.Id + "></ul></li>";
                    var ulName1 = ".deviceGuide" + device.Id;
                    $(ulName1).append(liText1);
                    var liText2 = "<li><a href=\"/Question/Index?deviceId=" + device.Id + "&manufacturerId=" + manufacturer.Id + "\">" + manufacturer.Name + "</a><ul class=manufacturer" + manufacturer.Id + "></ul></li>";
                    var ulName2 = ".deviceQuestion" + device.Id;
                    $(ulName2).append(liText2);
                });
            });
        });
    });

    $('#btnSearchContent').click(function () {
        var stringToSearch = $("#txtSearchContentString").val().trim();
        if (stringToSearch != null & stringToSearch != "") {
            window.location.href = "/Home/SearchContent?search=" + stringToSearch;
        }
    });

</script>
